Process Shift Model Report

Stan Model

## S4 class stanmodel 'PS-modelSpec' coded as follows:
## data {
##   int<lower=0> N; // num observations
##   int<lower=0> ni; // num items
##   int<lower=0> ns; // num subjects
##   int<lower=0> nsi; // num subject-item combos
##   int<lower=0> si_lookup[ns, ni]; // lookup table for sparsely coded subject-item offsets
##   int<lower=0> nt; // num trials
##   int<lower=0> nc; // num strategies
##   real<lower=0> y[N]; // log RT 
##   int<lower=0> strategy[N]; // strategy for a given obs
##   int<lower=0> item[N]; // item for a given obs
##   int<lower=0> subject[N]; // subject for a given obs
##   int<lower=0> trial[N]; // trial for a given obs
##   int<lower=0> isAlg[N]; // whether strat==alg for a given obs
##   int<lower=0> isRet[N]; // whether strat==ret for a given obs
## }
## 
## parameters {
##   real Alg_M; // overall mean for Algorithm
##   real Alg_M_es[ns]; // offset per subject for Alg mu
##   real Alg_M_ei[ni]; // offset per item for Alg mu
##   // real Alg_M_esi[ns,ni]; // offset per item for Alg mu
##   real Alg_M_esi[nsi]; // offset per subject-item for Alg mu (spasely coded)
##   real<lower=0> sigma_Alg_M_ei; // priors on Algorithm components ...
##   real<lower=0> sigma_Alg_M_es; 
##   real<lower=0> sigma_Alg_M_esi; 
## 
##   real Ret_B; // overall Beta for Retrieval
##   real Ret_B_es[ns]; // offset per subject for Ret beta
##   real Ret_B_ei[ni]; // offset per item for Ret beta
##   // real Ret_B_esi[ns,ni]; // offset per item for Ret beta
##   real Ret_B_esi[nsi]; 
##   real<lower=0> sigma_Ret_B_ei; // priors on Retrieval Beta components ...
##   real<lower=0> sigma_Ret_B_es; 
##   real<lower=0> sigma_Ret_B_esi; 
## 
##   real Ret_T; // overall Tau for Retrieval (rate)
##   real Ret_T_es[ns]; // offset per subject for Ret Tau
##   real Ret_T_ei[ni]; // offset per item for Ret Tau
##   //real Ret_T_esi[ns,ni]; // offset per item for Ret Tau
##   real Ret_T_esi[nsi]; 
##   real<lower=0> sigma_Ret_T_ei; // priors on Retrieval Tau components ...
##   real<lower=0> sigma_Ret_T_es; 
##   real<lower=0> sigma_Ret_T_esi; 
## 
##   // add asymptote parameter? 
## 
##   // add sigma variability 
## 
##   real<lower=0> sigma; // expand this to something similar to the above (variable sigma)
## }
## 
## transformed parameters {  
##   real Mu[N];
##   real Tau[N];
##   real Beta[N];
##   real y_hat[N];
##   for(i in 1:N){
##     // print(si_lookup[subject[i], item[i]])
##     Mu[i] = Alg_M + Alg_M_es[subject[i]]+Alg_M_ei[item[i]]+Alg_M_esi[si_lookup[subject[i], item[i]]];
##     Beta[i] = Ret_B + Ret_B_es[subject[i]]+Ret_B_ei[item[i]]+Ret_B_esi[si_lookup[subject[i], item[i]]];
##     Tau[i] = Ret_T + Ret_T_es[subject[i]]+Ret_T_ei[item[i]]+Ret_T_esi[si_lookup[subject[i], item[i]]];
##     y_hat[i] =  isAlg[i]*( Mu[i] ) + isRet[i]*( Beta[i] +exp(Tau[i])*log(17) - exp(Tau[i])*log(trial[i]));
##   }
##  }
## 
## model {
##   sigma ~ exponential(0.01);
## 
##   Alg_M ~ normal(7.6, 0.9); // set as overall mean and sd of data
##   Ret_B ~ normal(7.3, 1); // set as mean, sd for retrieval trials
##   Ret_T ~ normal(-1, 2); // no idea if this is reasonable ... 
## 
##   sigma_Alg_M_es ~ exponential(0.01);
##   sigma_Alg_M_ei ~ exponential(0.01);
##   sigma_Alg_M_esi ~ exponential(0.01);
## 
##   sigma_Ret_B_es ~ exponential(0.01);
##   sigma_Ret_B_ei ~ exponential(0.01);
##   sigma_Ret_B_esi ~ exponential(0.01);
## 
##   sigma_Ret_T_es ~ exponential(0.01);
##   sigma_Ret_T_ei ~ exponential(0.01);
##   sigma_Ret_T_esi ~ exponential(0.01);
##   
##   Alg_M_es ~ normal(0, sigma_Alg_M_es);
##   Alg_M_ei ~ normal(0, sigma_Alg_M_ei);
##   Alg_M_esi ~ normal(0, sigma_Alg_M_esi);
##   // for(i in 1:ns) {
##   //   for(j in 1:ni)
##   //     Alg_M_esi[i,j] ~ normal(0, sigma_Alg_M_esi);
##   // }
## 
##   Ret_B_es ~ normal(0, sigma_Ret_B_es);
##   Ret_B_ei ~ normal(0, sigma_Ret_B_ei);
##   Ret_B_esi ~ normal(0, sigma_Ret_B_esi);
##   // for(i in 1:ns) {
##   //   for(j in 1:ni)
##   //     Ret_B_esi[i,j] ~ normal(0, sigma_Ret_B_esi);
##   // }
## 
##   Ret_T_es ~ normal(0, sigma_Ret_T_es);
##   Ret_T_ei ~ normal(0, sigma_Ret_T_ei);
##   Ret_T_esi ~ normal(0, sigma_Ret_T_esi);
##   // for(i in 1:ns) {
##   //   for(j in 1:ni)
##   //     Ret_T_esi[i,j] ~ normal(0, sigma_Ret_T_esi);
##   // }
## 
##   y ~ normal(y_hat, sigma);
## }
## 
## generated quantities {
##   vector[N] logLik; 
##   for(n in 1:N){
##     logLik[n] = normal_lpdf(y[n] | y_hat[n], sigma);
##   }
## }

Model Fit to Data

Diagnostics

Rhat distribution

Rhats for component parameters

Each spike represents the R-hat value for a particular component parameter. Below, very high values are examined more closely.

## [[1]]

## 
## [[2]]

## 
## [[3]]

## 
## [[4]]

## 
## [[5]]

Extreme Rhat values (z.score(Rhat) > 1.75)

Parameter param mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat Rhat.z
Alpha Alg_M_esi[92] 0.0023550 0.0005702 0.0092914 -0.0134858 -0.0015815 0.0003902 0.0053018 0.0266321 265.569691 1.016694 2.645455
Log Posterior lp__ 7922.6844786 195.5439612 373.2921985 7458.4759821 7656.5129034 7822.4766967 8035.3082867 8779.8316944 3.644257 1.970450 153.283269
Sigma sigma_Alg_M_esi 0.0070341 0.0020580 0.0054287 0.0002506 0.0029349 0.0059863 0.0102036 0.0196777 6.958616 1.399231 63.063896
## [[1]]

Raw Data for Alg_M_esi[92] col (item) = 5, row (subject) = 10

(With neighbors for comparison)